---
title: "Quick Start"
description: "Get your first MentraOS app running in 5 minutes"
---

## Prerequisites

Before you begin, make sure you have:

<Steps>
  <Step title="Bun">
    Install [Bun](https://bun.sh) - our JavaScript runtime and package manager
  </Step>
  <Step title="Developer Account">
    Sign up at [dev.mentraos.com](https://dev.mentraos.com) to get your API key
  </Step>
  <Step title="MentraOS App">
    Install the MentraOS mobile app and connect your smart glasses
  </Step>
</Steps>

## Create Your First App

### 1. Install the SDK

```bash
bun add @mentraos/sdk
```

### 2. Create Your App

Create a new file `app.ts` with strict TypeScript:

```typescript
import { AppServer, AppSession } from '@mentraos/sdk';

// Extend AppServer and override onSession
class MyAppServer extends AppServer {
  protected async onSession(
    session: AppSession,
    sessionId: string, // Format: "userId-packageName"
    userId: string
  ): Promise<void> {
    console.log(`New session: ${sessionId} for user: ${userId}`);
    
    // Show welcome message
    await session.layouts.showTextWall('Hello from MentraOS!');
    
    // Listen for transcriptions
    session.events.onTranscription((data) => {
      console.log(`User said: ${data.text}`);
      
      // Respond to "hello"
      if (data.text.toLowerCase().includes('hello')) {
        session.layouts.showReferenceCard({
          title: 'Greeting',
          text: 'Hello! How can I help you today?'
        });
      }
    });
    
    // Listen for button presses
    session.events.onButtonPress((data) => {
      console.log(`Button pressed: ${data.buttonId}`);
      session.layouts.showTextWall('Button pressed!');
    });
  }
}

// Create and start the server
const server = new MyAppServer({
  packageName: 'com.example.myapp',
  apiKey: process.env.MENTRAOS_API_KEY!,
  port: 3000
});

await server.start();
console.log('App server running on port 3000');
```

### 3. Set Your API Key

Create a `.env` file:

```bash
MENTRAOS_API_KEY=your_api_key_here
```

### 4. Run Your App

```bash
bun run app.ts
```

## Connect Your App

<Steps>
  <Step title="Open Developer Portal">
    Go to [dev.mentraos.com](https://dev.mentraos.com) and navigate to your app
  </Step>
  <Step title="Set Webhook URL">
    Set your webhook URL to `http://your-server.com/webhook`
  </Step>
  <Step title="Start the App">
    In the MentraOS mobile app, say "Start [your app name]"
  </Step>
</Steps>

## What's Next?

<CardGroup cols={2}>
  <Card
    title="Cloud Architecture"
    icon="cloud"
    href="/1-overview"
  >
    Understand how MentraOS Cloud works under the hood
  </Card>
  <Card
    title="Message Types"
    icon="message"
    href="/4-message-types"
  >
    Learn about all the messages you can send and receive
  </Card>
  <Card
    title="SDK Reference"
    icon="code"
    href="/5-sdk-and-apps"
  >
    Explore the full SDK API and build advanced features
  </Card>
</CardGroup>

## Need Help?

- Join our [Discord community](https://discord.gg/5ukNvkEAqT)
- Check out [example apps](https://github.com/Mentra-Community/MentraOS/tree/main/examples)
- Read the [troubleshooting guide](/troubleshooting)
